#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<stdlib.h>
using namespace std;
int n,l,r;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>l>>r;
	if(l/n*n+n-1<=r)
		cout<<n-1;
	else
		cout<<r%n;
	return 0;
}
